<?php
if (isset($member_email)) {
    echo $this->partial('header/wellcome.phtml', array('member_email' => $member_email));
}
?>
<form class="form-horizontal" id="searchProduct" name="searchProduct" onsubmit="productController.searchProduct(); return false;">
    <div class="form-group">
        <label for="keyword" class="col-sm-2 control-label">Tìm kiếm</label>
        <div class="col-md-6">
            <input type="text" id="keyword" class="form-control" name="keyword">
        </div>
    </div>
</form>
<div class="row row-offcanvas row-offcanvas-right">
    <div class="col-xs-12 col-sm-9">
        <div class="row">
            <ul class="nav nav-pills">
                <li>
                    <a href="<?php echo $this->url('product/product-by-type', array('type' => 1, 'type_name' => 'san-pham-moi.html')); ?>">Sản phẩm mới ra mắt</a>
                </li>
            </ul>
            <?php foreach ($aryNewProduct as $key => $newProduct) { ?>
                <div class="col-sm-6 col-md-4">
                    <div class="thumbnail">
                        <a href="<?php echo $this->url('product/product-detail', array('product_id' => $newProduct['product_id'], 'product_name' => $newProduct['product_name_filter'] . '.html')); ?>">
                            <img alt="<?php echo $newProduct['product_name']; ?>" style="height: 200px; width: 100%; display: block;" src="/upload/images/thumb/<?php echo $newProduct['product_image']; ?>">
                        </a>
                        <div class="caption">
                            <h5><a href="<?php echo $this->url('product/product-detail', array('product_id' => $newProduct['product_id'], 'product_name' => $newProduct['product_name_filter'] . '.html')); ?>"><?php echo $newProduct['product_name']; ?></a></h5>
                            <?php if ($newProduct['product_price_sale_of']) { ?>
                                <p>
                                    <span style="text-decoration: line-through;padding-right: 10px;">
                                        <?php echo number_format($newProduct['product_price'], 0, ',', '.') ?>&nbsp;vnđ
                                    </span>
                                    <span><?php echo number_format($newProduct['product_price_sale_of'], 0, ',', '.') ?>&nbsp;vnđ</span>
                                </p>
                            <?php } else { ?>
                                <p><?php echo number_format($newProduct['product_price'], 0, ',', '.') ?>&nbsp;vnđ</p>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            <?php } ?>
        </div>
        <div class="row">
            <ul class="nav nav-pills">
                <li><a href="<?php echo $this->url('product/product-by-type', array('type' => 2, 'type_name' => 'san-pham-khuyen-mai.html')); ?>">Sản phẩm khuyến mại</a></li>
            </ul>
            <?php foreach ($arySaleOfProduct as $key => $saleProduct) { ?>
                <div class="col-sm-6 col-md-4">
                    <div class="thumbnail">
                        <a href="<?php echo $this->url('product/product-detail', array('product_id' => $saleProduct['product_id'], 'product_name' => $saleProduct['product_name_filter'] . '.html')); ?>">
                            <img alt="<?php echo $saleProduct['product_name']; ?>" style="height: 200px; width: 100%; display: block;" src="/upload/images/thumb/<?php echo $saleProduct['product_image']; ?>">
                        </a>
                        <div class="caption">
                            <h5><a href="<?php echo $this->url('product/product-detail', array('product_id' => $saleProduct['product_id'], 'product_name' => $saleProduct['product_name_filter'] . '.html')); ?>"><?php echo $saleProduct['product_name']; ?></a></h5>
                            <?php if ($saleProduct['product_price_sale_of']) { ?>
                                <p>
                                    <span style="text-decoration: line-through;padding-right: 10px;"><?php echo number_format($saleProduct['product_price'], 0, ',', '.') ?>&nbsp;vnđ</span>
                                    <span><?php echo number_format($saleProduct['product_price_sale_of'], 0, ',', '.') ?>&nbsp;vnđ</span>
                                </p>
                            <?php } else { ?>
                                <p><?php echo number_format($saleProduct['product_price'], 0, ',', '.') ?>&nbsp;vnđ</p>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            <?php } ?>
        </div>
        <div class="row">
            <ul class="nav nav-pills">
                <li>
                    <a href="<?php echo $this->url('product/product-by-type', array('type' => 3, 'type_name' => 'san-pham-ban-chay.html')); ?>">Sản phẩm bán chạy</a>
                </li>
            </ul>
            <?php foreach ($aryTopProduct as $key => $topProduct) { ?>
                <div class="col-sm-6 col-md-4">
                    <div class="thumbnail">
                        <a href="<?php echo $this->url('product/product-detail', array('product_id' => $topProduct['product_id'], 'product_name' => $topProduct['product_name_filter'] . '.html')); ?>">
                            <img alt="<?php echo $topProduct['product_name']; ?>" style="height: 200px; width: 100%; display: block;" src="/upload/images/thumb/<?php echo $topProduct['product_image']; ?>">
                        </a>
                        <div class="caption">
                            <h5><a href="<?php echo $this->url('product/product-detail', array('product_id' => $topProduct['product_id'], 'product_name' => $topProduct['product_name_filter'] . '.html')); ?>"><?php echo $topProduct['product_name']; ?></a></h5>
                            <?php if ($topProduct['product_price_sale_of']) { ?>
                                <p>
                                    <span style="text-decoration: line-through;padding-right: 10px;"><?php echo number_format($topProduct['product_price'], 0, ',', '.') ?>&nbsp;vnđ</span>
                                    <span><?php echo number_format($topProduct['product_price_sale_of'], 0, ',', '.') ?>&nbsp;vnđ</span>
                                </p>
                            <?php } else { ?>
                                <p><?php echo number_format($topProduct['product_price'], 0, ',', '.') ?>&nbsp;vnđ</p>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            <?php } ?>
        </div>
    </div><!--/span-->

    <div role="navigation" id="sidebar" class="col-xs-6 col-sm-3 sidebar-offcanvas">
        <?php include 'category.phtml'; ?>
    </div><!--/span-->
</div>